<!--轮播图上的 导航-->
<template>
  <div class="nav-z" >
    <!-- <div class="nav-left" >
      <ul>
        <li
          v-for="(item, index) in bannernav"
          :key="item.id"
          class="ul-nav"
          :class="{active: navActive[index]}"
          @mousemove.stop="enter(index)"
          @mouseleave="out(index)"
        >
          <ol>
            <img :src="item.icon" />
            <span>{{ item.name }}</span>
          </ol>

          <div v-show="show">
            <div class="nav-content" v-show="item.is_show" @mouseover.stop="enter(index)">
              <banner-nav-content :children="item.children" :title="item.name"></banner-nav-content>
            </div>
          </div>
        </li>
      </ul>
    </div> -->

   
  </div>
</template>

<script>
import image from "@/assets/images/headPortrait.png";
import bannerNavContent from "./Banner_nav_content"; //子菜单的详情
import bannerIcon1 from "@/assets/icon/bannerIcon1.png";
import bannerIcon2 from "@/assets/icon/bannerIcon2.png";
import bannerIcon3 from "@/assets/icon/bannerIcon3.png";
import bannerIcon4 from "@/assets/icon/bannerIcon4.png";
import bannerIcon5 from "@/assets/icon/bannerIcon5.png";
export default {
  name: "bannerNav",
  data() {
    return {
      bannerIcon: [
        { bannericon: bannerIcon1 },
        { bannericon: bannerIcon2 },
        { bannericon: bannerIcon3 },
        { bannericon: bannerIcon4 },
        { bannericon: bannerIcon5 }
      ],
      navActive: [], // 轮播图的导航 active的 保留
      
      show: 0,
    };
  },

  methods: {
  
    // 鼠标进入时候出发的函数
    enter(index) {
      setTimeout(() => {
        this.show = 1;
        this.bannernav[index].is_show = 1;
        this.navActive[index] = 1; //  用来控制nav
      });
      // this.show = 1
      // this.bannernav[index].is_show = 1
      // this.navActive[index] = 1 //  用来控制navActive在进入子菜单时 仍然保持的active
    },

    // 鼠标离开时候触发的函数
    out(index) {
      this.show = 0;
      this.bannernav[index].is_show = 0;
      this.navActive[index] = 0; //  用来控制navActive在进入子菜单时 仍然保持的active
    }
  },

  components: {
    bannerNavContent
  },

  computed: {
    bannernav() {
      let bannerArr = [...new Set(this.$store.state.bannernav)];
      let flagArr = bannerArr.map((item, index) => {
        item.icon = this.bannerIcon[index].bannericon;
        return item;
      });

      return flagArr;
    }
  },
};
</script>

<style lang="scss" scoped>
.nav-z {
  width: 1200px;
  // height: 220px;
  position: absolute;
  top: 186px;
  left: calc((100% - 1200px) / 2);
  z-index: 991;
  margin: auto;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  .nav-left {
    width: 212px;
    // min-height: 220px;
    background-color: rgba($color: #409eff, $alpha: 1);
    position: relative;
    overflow-y: auto;
    overflow-x: hidden;
    // /*滚动条样式*/
    // &::-webkit-scrollbar {/*滚动条整体样式*/
    //     width: 4px;     /*高宽分别对应横竖滚动条的尺寸*/
    //     height: 4px;
    // }
    // &::-webkit-scrollbar-thumb {/*滚动条里面小方块*/
    //     border-radius: 5px;
    //     // -webkit-box-shadow: inset 0 0 5px rgba(245, 101, 6, 0.5);
    //     background: rgba(121, 118, 118, 0.973);
    // }
    // &::-webkit-scrollbar-track {/*滚动条里面轨道*/
    //     // -webkit-box-shadow: inset 0 0 5px rgba(245, 101, 6, 0.5);
    //     border-radius: 0;
    //     background: rgba(193, 236, 233, 0.918);
    // }
    ul {
      box-sizing: border-box;
      color: #fff;
      width: 212px;
      // height: 220px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      
      .ul-nav {
        box-sizing: border-box;
        position: relative;
        
        border-top: #fff 1px solid;
        ol {
          width: 100%;
          font-size: 14px;
          cursor: pointer;
          height: 66px;
          line-height: 82px;
          display: flex;
          flex-direction: row;
          align-items: center;
          overflow: hidden;
          img {
            width: 18px;
            padding-left: 37px;
          }
          span {
            padding-left: 8px;
            overflow: hidden;
            white-space: nowrap;
            text-overflow: ellipsis;
          }
        }
        .nav-content {
          width: 988px;
          height: 335px;
          background: #fff;
        
          position: fixed;
          top: 186px;
          margin-left: 212px;
          color: #000;
          z-index: 100;
        }
      }
      .active {
        color: #fff;
        background: #ff7e00;
      }
    }
  }

  .right-content {
    width: 212px;
    height: 335px;
    background-color: rgba($color: #ffffff, $alpha: 1);
    color: #ffffff;
    cursor: pointer;
    .headPortrait {
      width: 100%;
      height: 36px;
      margin-top: 20px;
      .headPortraittext {
        display: inline-block;
        text-align: center;
        width: 100%;
        font-size: 40px;
        font-weight: 300;
      }
      img {
        margin: auto;
        width: 60px;
        height: 60px;
        display: block;
        margin: auto;
        border-radius: 50%;
        overflow: hidden;
      }
      .headPortraitHover {
        position: relative;
        transition: all 0.7s ease-in;
      }
      p {
        margin: auto;
        width: 90%;
        line-height: 40px;
        text-align: center;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        font-family: "微软雅黑";
      }
      ul {
        width: 76%;
        height: 26px;
        margin: auto;
        display: flex;
        flex-direction: row;
        justify-content: space-around;
        li {
          width: 78px;
          height: 26px;
          line-height: 26px;
          text-align: center;
          border-radius: 5px;
          background: #409eff;
          letter-spacing: 2px;
          &:hover {
            color: #409eff;
            background: #fff;
          }
        }
      }
      .minbanner {
        width: 100%;
        height: 172px;
        .block {
          ol {
            padding-top: 20px;
            padding-left: 25px;
            li {
              line-height: 25px;
              font-size: 12px;
              display: flex;
              flex-direction: row;
              align-items: center;

              &:hover {
                span {
                  i {
                    transition: all 0.3s ease-in;
                    width: 20px;
                    font-size: 14px;
                    font-weight: bold;
                    margin-right: 3px;
                    color: #f40;
                  }
                }
              }
              span {
                display: flex;
                flex-direction: row;
                align-items: center;
                i {
                  width: 20px;
                  font-size: 13px;
                  margin: 0px 3px;
                }
              }
              i {
                width: 112px;
                overflow: hidden;
                white-space: nowrap;
                text-overflow: ellipsis;
              }
            }
          }
        }
      }
      .demand {
        width: 100%;
        ol {
          width: 172px;
          margin: auto;
          display: flex;
          flex-direction: row;
          justify-content: space-between;
          font-size: 12px;
          color: #ffe400;
          letter-spacing: 0.8px;
          li {
            &:hover {
              p {
                transition: all 0.3s ease-in-out;
                font-size: 34px;
              }
            }
            p {
              font-size: 30px;
            }
          }
        }
      }
    }
  }
}
@media screen and (max-width: 1196px) {
  .nav-z {
    position: absolute;
    top: 0px;
    left: 0px;
    z-index: 0;
  }
}
</style>
<style>
.minbanner .block .el-carousel__indicator {
  display: none !important;
}
.minbanner .block button {
  display: none !important;
}
</style>

